package test;

public class BlogService {
   private State state;
   private Visibility visibility;
   private Byte status;

   public void setState(State state){
       this.state = state;
   }

    public void setVisibility(Visibility visibility) {
        this.visibility = visibility;
    }

    public void action(){
       state.handle();
   }

   public void changeState(){
       switch (status){
           case 0:
               setState(new OtherState());
               break;
           case 1:
               setState(new ValidState());
               break;
           case 2:
               /*...*/
               break;
           default:
       }
   }

    public void changeVisibility(){
        switch (status){
            case 0:
                setVisibility(new PublicVisibility());
                break;
            case 1:
                /*...*/
                break;
            default:
        }
    }
}
